/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.app.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Thuan
 */
@Embeddable
public class SubjectOfCoursePK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "subjectId")
    private int subjectId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "courseId")
    private int courseId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "semesterId")
    private int semesterId;

    public SubjectOfCoursePK() {
    }

    public SubjectOfCoursePK(int subjectId, int courseId, int semesterId) {
        this.subjectId = subjectId;
        this.courseId = courseId;
        this.semesterId = semesterId;
    }

    public int getSubjectId() {
        return subjectId;
    }

    public void setSubjectId(int subjectId) {
        this.subjectId = subjectId;
    }

    public int getCourseId() {
        return courseId;
    }

    public void setCourseId(int courseId) {
        this.courseId = courseId;
    }

    public int getSemesterId() {
        return semesterId;
    }

    public void setSemesterId(int semesterId) {
        this.semesterId = semesterId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) subjectId;
        hash += (int) courseId;
        hash += (int) semesterId;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SubjectOfCoursePK)) {
            return false;
        }
        SubjectOfCoursePK other = (SubjectOfCoursePK) object;
        if (this.subjectId != other.subjectId) {
            return false;
        }
        if (this.courseId != other.courseId) {
            return false;
        }
        if (this.semesterId != other.semesterId) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.app.model.SubjectOfCoursePK[ subjectId=" + subjectId + ", courseId=" + courseId + ", semesterId=" + semesterId + " ]";
    }

}
